using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace QLThuHocPhi
{
    public partial class SystemForm : Form
    {
        public SystemForm()
        {
            InitializeComponent();
        }
        QLThuHocPhi.Database.DBTool dbt = new QLThuHocPhi.Database.DBTool();
         
        public SystemForm(int i)
        {
            InitializeComponent();
            createaccount.Enabled=false;
        }

        private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormLogin fl = new FormLogin();
           fl.Show();
           this.Close();
           // this.SetVisibleCore(false);
            //Application.Restart();
        }

        private void SystemForm_Load(object sender, EventArgs e)
        {

        }

        private void createaccount_Click(object sender, EventArgs e)
        {
            dbt.loadform(QLThuHocPhi.Database.DBTool.username);
            string tenvn =QLThuHocPhi.Database.DBTool.quyen;
            if (!tenvn.Equals("Admin")) {
                MessageBox.Show("Bạn không có quyền Admin");
                return;
            }
            foreach (Form f1 in this.MdiChildren)
            {
             
                    f1.Close();
                    break;
                
            }
            AddEmployee ae = new AddEmployee();
            ae.MdiParent = this;
            ae.Show();
        }

        private void danhSáchNhânViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            ListEmploy le = new ListEmploy();
            le.MdiParent = this;
            le.Show();
            //this.SetVisibleCore(false);
        }

        private void thayĐổiThôngTinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                
                    f1.Close();
                    break;
                
            }
            EditInformation ei = new EditInformation();
            ei.MdiParent = this;
            ei.Show();
        }

        private void nhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            ListStudent ls = new ListStudent();
            ls.MdiParent=this;
            ls.Show();
            //this.SetVisibleCore(false);
        }

        private void nhậpKhoaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            ListKhoa lk = new ListKhoa();
            lk.MdiParent = this;
            lk.Show();
           // this.SetVisibleCore(false);
        }

        private void nhậpMứcHọcPhíToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            ListMucHocPhi mhp = new ListMucHocPhi();
            mhp.MdiParent = this;
            mhp.Show();
            //this.SetVisibleCore(false);
        }

        private void nhậpMônHọcToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            ListMonHoc lmh = new ListMonHoc();
            lmh.MdiParent = this;
            lmh.Show();
        }

        private void SystemForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Dispose();
                break;
            }
            this.Dispose();
        }

        private void SystemForm_FormClosing(object sender, FormClosingEventArgs e)
        {

            System.Windows.Forms.Application.Exit();
        }

        private void quảnLýBáoCáoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            FormDKHoc1 mhp = new FormDKHoc1();
            mhp.MdiParent = this;
            mhp.Show();
        }

        private void sinhViToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            FrmDKHoc mhp = new FrmDKHoc();
            mhp.MdiParent = this;
            mhp.Show();
        }

        private void sinhViênDiệnƯuTiênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //foreach (Form f1 in this.MdiChildren)
            //{
            //    f1.Close();
            //    break;
            //}
            //FormDKHoc1 mhp = new FormDKHoc1();
            //mhp.MdiParent = this;
            //mhp.Show();
        }

        private void họcPhíSinhViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            FormThongKe mhp = new FormThongKe();
            mhp.MdiParent = this;
            mhp.Show();
        }

        private void thuChiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            BaoCaoChiTiet mhp = new BaoCaoChiTiet();
            mhp.MdiParent = this;
            mhp.Show();
        }

        private void danhSáchMứcƯuTiênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form f1 in this.MdiChildren)
            {
                f1.Close();
                break;
            }
            FormUuTien mhp = new FormUuTien();
            mhp.MdiParent = this;
            mhp.Show();
        }
    }
}